$(function () {
    $.ajax({
        type: "get",
        url: "../interface/index.php",
        dataType: "json"
    }).then(res => {

        let template = '';

        res.forEach(elm => {
            template += `
            <li>
                <a href="./detail.html?id=${elm.id}">
                    <img src="./${elm.picture}">
                    <h3>${elm.title}</h3>
                    <p>${elm.introduce}</p>
                    <span>${elm.price}起</span>
                </a>
            </li>
        `;
        });

        $('.product_phone>ul').html(template);

    }).catch(xhr => {
        console.log(xhr.status);
    });
})